900 |
How do I get ride of the separator items when the user performs grouping
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection. procedure TForm1.Grid1AddGroupItem(ASender: TObject; Item : HITEM); begin with Grid1 do begin Items.ItemDividerLine[Item] := EXGRIDLib_TLB.EmptyLine; end end; with Grid1 do begin BeginUpdate(); ColumnAutoResize := False; rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Null); end; DataSource := (IUnknown(rs) as ADODB_TLB.Recordset); SortBarVisible := True; SortBarCaption := 'Drag a <b>column</b> header here to group by that column.'; AllowGroupBy := True; Columns.Item[OleVariant(1)].SortOrder := EXGRIDLib_TLB.SortAscending; LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside; EndUpdate(); end |
899 |
How do I split a cell in three parts, and having a radio button in each of them
// CellStateChanged event - Fired after cell's state has been changed. procedure TForm1.Grid1CellStateChanged(ASender: TObject; Item : HITEM;ColIndex : Integer); begin with Grid1 do begin OutputDebugString( Items.CellCaption[OleVariant(Item),OleVariant(ColIndex)] ); end end; // Click event - Occurs when the user presses and then releases the left mouse button over the grid control. procedure TForm1.Grid1Click(ASender: TObject; ); begin with Grid1 do begin h := ItemFromPoint[-1,-1,c,hit]; Items.CellState[OleVariant(h),OleVariant(c)] := 1; end end; with Grid1 do begin BeginUpdate(); FullRowSelect := EXGRIDLib_TLB.exColumnSel; SelBackColor := BackColor; SelForeColor := ForeColor; DrawGridLines := EXGRIDLib_TLB.exAllLines; ShowFocusRect := False; (IUnknown(Columns.Add('Default')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); with Items do begin h := AddItem('entire'); h := AddItem('Radio <b>1'); CellRadioGroup[OleVariant(h),OleVariant(0)] := 100; CellHasRadioButton[OleVariant(h),OleVariant(0)] := True; CellState[OleVariant(h),OleVariant(0)] := 1; h := SplitCell[OleVariant(h),OleVariant(0)]; CellValue[OleVariant(0),OleVariant(h)] := 'Radio <b>2'; CellRadioGroup[OleVariant(0),OleVariant(h)] := 100; CellHasRadioButton[OleVariant(0),OleVariant(h)] := True; h := SplitCell[OleVariant(0),OleVariant(h)]; CellValue[OleVariant(0),OleVariant(h)] := 'Radio <b>3'; CellRadioGroup[OleVariant(0),OleVariant(h)] := 100; CellHasRadioButton[OleVariant(0),OleVariant(h)] := True; h := AddItem('entire'); end; EndUpdate(); end |
898 |
Does your grid include a row indicator , like an arrow, bullet
// SelectionChanged event - Fired after a new item has been selected. procedure TForm1.Grid1SelectionChanged(ASender: TObject; ); begin with Grid1 do begin with Items do begin hFocusItem := FocusItem; CellValue[Grid1.Columns.Item['active'].Data,'active'] := ''; CellValue[OleVariant(hFocusItem),'active'] := '<c><font symbol>·'; CellVAlignment[OleVariant(hFocusItem),'active'] := EXGRIDLib_TLB.exBottom; Grid1.Columns.Item['active'].Data := OleVariant(hFocusItem); end; end end; with Grid1 do begin BeginUpdate(); ColumnAutoResize := False; rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Null); end; DataSource := (IUnknown(rs) as ADODB_TLB.Recordset); ShowFocusRect := False; ContinueColumnScroll := True; ScrollBySingleLine := True; AutoDrag := Integer(EXGRIDLib_TLB.exAutoDragScrollOnShortTouch) Or Integer(EXGRIDLib_TLB.exAutoDragScroll); with (IUnknown(Columns.Add('')) as EXGRIDLib_TLB.Column) do begin Key := 'active'; Position := 0; AllowSizing := False; Width := 12; Data := OleVariant(Grid1.Items.FocusItem); Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); end; CountLockedColumns := 1; with Items do begin SelectItem[NextVisibleItem[FocusItem]] := True; end; EndUpdate(); end |
897 |
How can I connect to a DBF file
with Grid1 do begin ColumnAutoResize := False; ContinueColumnScroll := False; rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADODB.Recordset'))) as ADODB_TLB.Recordset); with rs do begin Open('Select * From foxcode.DBF','Provider=vfpoledb;Data Source=C:\Program Files\Microsoft Visual FoxPro 9\',3,3,Null); end; DataSource := (IUnknown(rs) as ADODB_TLB.Recordset); end |
896 |
Does your control supports scrolling by touching the screen
with Grid1 do begin ColumnAutoResize := False; rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Null); end; DataSource := (IUnknown(rs) as ADODB_TLB.Recordset); ContinueColumnScroll := True; ScrollBySingleLine := True; AutoDrag := Integer(EXGRIDLib_TLB.exAutoDragScrollOnShortTouch) Or Integer(EXGRIDLib_TLB.exAutoDragScroll); end |
895 |
How do I prevent showing the control's BackColorAlternate property on empty / non-items part of the control
with Grid1 do begin BeginUpdate(); BackColorAlternate := $7ff0f0f0; Columns.Add('Column'); with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); AddItem('Item 4'); AddItem('Item 5'); end; EndUpdate(); end |
894 |
Is there any method for reading information from the root item for the current item...
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; SearchColumnIndex := 0; Columns.Add('Info'); with Items do begin PathSeparator := ' ; '; SelectItem[InsertItem(InsertItem(InsertItem(InsertItem(Null,Null,'Root'),Null,'Child'),Null,'Sub-Child'),Null,'Sub-Sub-Child')] := True; ExpandItem[0] := True; OutputDebugString( FullPath[FocusItem] ); end; EndUpdate(); end |
893 |
How can I highlight items with a specified date
with Grid1 do begin BeginUpdate(); with Columns do begin Add('Tasks'); with (IUnknown(Add('Date')) as EXGRIDLib_TLB.Column) do begin SortType := EXGRIDLib_TLB.SortDate; Editor.EditType := EXGRIDLib_TLB.SpinType; end; end; with Items do begin CellValue[OleVariant(AddItem('Task 1')),OleVariant(1)] := '12/13/2001'; CellValue[OleVariant(AddItem('Task 2')),OleVariant(1)] := '12/14/2001'; CellValue[OleVariant(AddItem('Task 2')),OleVariant(1)] := '12/15/2001'; end; ConditionalFormats.Add('%1 = #12/14/2001#',Null).Bold := True; EndUpdate(); end |
892 |
Today date is shown, if we use the Column.FormatColumn and Editor.Option(exDateAllowNullDate) properties. What can be done
with Grid1 do begin BeginUpdate(); with (IUnknown(Columns.Add('Date')) as EXGRIDLib_TLB.Column) do begin FormatColumn := 'len(value) ? ( (longdate(date(value)) left 3) + '' '' + day(date(value)) + ''/'' + month(date(value)) + ''/'' + (year(date(value)) rig' + 'ht 2) ) : '''' )'; with Editor do begin EditType := EXGRIDLib_TLB.DateType; Option[EXGRIDLib_TLB.exDateAllowNullDate] := OleVariant(True); end; end; with Items do begin AddItem('5/12/2012'); AddItem(Null); AddItem('5/14/2012'); end; EndUpdate(); end |
891 |
How can I add multiple values/columns on the same line/item/row
// Change event - Occurs when the user changes the cell's content. procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant); begin with Grid1 do begin Refresh(); end end; with Grid1 do begin BeginUpdate(); SortOnClick := EXGRIDLib_TLB.exNoSort; LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside; Indent := 13; HeaderVisible := False; LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; with Columns do begin Add('Items'); (IUnknown(Add('Quantity')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.SpinType; (IUnknown(Add('Value')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.SpinType; end; with Items do begin h := AddItem('Items'); CellValue[OleVariant(h),OleVariant(2)] := 'sum(current,dir,dbl(%1)*dbl(%2))'; CellValueFormat[OleVariant(h),OleVariant(2)] := EXGRIDLib_TLB.exTotalField; FormatCell[OleVariant(h),OleVariant(2)] := '`Total: `+ value'; CellHAlignment[OleVariant(h),OleVariant(2)] := EXGRIDLib_TLB.RightAlignment; CellBold[OleVariant(h),OleVariant(2)] := True; CellEditorVisible[OleVariant(h),OleVariant(2)] := EXGRIDLib_TLB.exEditorHidden; CellEditorVisible[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exEditorHidden; h1 := InsertItem(h,Null,'Item 1'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(10); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(3); h1 := InsertItem(h,Null,'Item 2'); CellValue[OleVariant(h1),OleVariant(1)] := OleVariant(20); CellValue[OleVariant(h1),OleVariant(2)] := OleVariant(4); ExpandItem[h] := True; end; EndUpdate(); end |
890 |
Is there a syntax for conditional formatting of items, based on CellState/CellStateChange
// CellStateChanged event - Fired after cell's state has been changed. procedure TForm1.Grid1CellStateChanged(ASender: TObject; Item : HITEM;ColIndex : Integer); begin with Grid1 do begin with Items do begin CellValue[OleVariant(Item),OleVariant(2)] := OleVariant(CellState[OleVariant(Item),OleVariant(0)]); end; end end; with Grid1 do begin BeginUpdate(); ShowFocusRect := False; SelBackMode := EXGRIDLib_TLB.exTransparent; var_ConditionalFormat := ConditionalFormats.Add('%2 != 0',Null); with var_ConditionalFormat do begin Bold := True; ForeColor := $ff; ApplyTo := EXGRIDLib_TLB.exFormatToItems; end; with (IUnknown(Columns.Add('')) as EXGRIDLib_TLB.Column) do begin Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True); Width := 16; AllowSizing := False; end; Columns.Add('Information'); (IUnknown(Columns.Add('Hidden')) as EXGRIDLib_TLB.Column).Visible := False; with Items do begin CellValue[OleVariant(AddItem('')),OleVariant(1)] := 'This is a bit of text associated'; h := AddItem(''); CellValue[OleVariant(h),OleVariant(1)] := 'This is a bit of text associated'; CellState[OleVariant(h),OleVariant(0)] := 1; CellValue[OleVariant(AddItem('')),OleVariant(1)] := 'This is a bit of text associated'; end; EndUpdate(); end |
889 |
How do I programatically focus a cell
// FocusChanged event - Occurs when a new cell is focused. procedure TForm1.Grid1FocusChanged(ASender: TObject; ); begin with Grid1 do begin with Items do begin CellBackColor[OleVariant(FocusItem),OleVariant(Grid1.FocusColumnIndex)] := $ff; end; end end; with Grid1 do begin BeginUpdate(); SelForeColor := ForeColor; SelBackColor := BackColor; DrawGridLines := EXGRIDLib_TLB.exRowLines; with Columns do begin Add('Column1'); Add('Column2'); end; with Items do begin CellValue[OleVariant(AddItem('Cell 1.1')),OleVariant(1)] := 'Cell 1.2'; CellValue[OleVariant(AddItem('Cell 2.1')),OleVariant(1)] := 'Cell 2.2'; end; with Items do begin SelectItem[ItemByIndex[1]] := True; end; FocusColumnIndex := 1; EndUpdate(); end |
888 |
How do I programatically focus a cell (excrd)
// FocusChanged event - Occurs when a new cell is focused. procedure TForm1.Grid1FocusChanged(ASender: TObject; ); begin with Grid1 do begin with Items do begin CellBackColor[OleVariant(FocusItem),OleVariant(Grid1.FocusColumnIndex)] := $ff; end; end end; with Grid1 do begin BeginUpdate(); SelForeColor := ForeColor; SelBackColor := BackColor; DrawGridLines := EXGRIDLib_TLB.exRowLines; DefaultItemHeight := 36; with Columns do begin (IUnknown(Add('Column1')) as EXGRIDLib_TLB.Column).Visible := False; (IUnknown(Add('Column2')) as EXGRIDLib_TLB.Column).Visible := False; (IUnknown(Add('Column3')) as EXGRIDLib_TLB.Column).Visible := False; with (IUnknown(Add('FormatLevel')) as EXGRIDLib_TLB.Column) do begin FormatLevel := '(0/1),2'; Def[EXGRIDLib_TLB.exCellFormatLevel] := OleVariant(FormatLevel); end; end; with Items do begin h := AddItem('Cell 1.1'); CellValue[OleVariant(h),OleVariant(1)] := 'Cell 1.2'; CellValue[OleVariant(h),OleVariant(2)] := 'Cell 1.3'; h := AddItem('Cell 2.1'); CellValue[OleVariant(h),OleVariant(1)] := 'Cell 2.2'; CellValue[OleVariant(h),OleVariant(2)] := 'Cell 2.3'; end; with Items do begin SelectItem[ItemByIndex[1]] := True; end; FocusColumnIndex := 2; EndUpdate(); end |
887 |
How do I programmatically exclude items from the filter
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; with (IUnknown(Columns.Add('Items')) as EXGRIDLib_TLB.Column) do begin DisplayFilterButton := True; DisplayFilterPattern := False; FilterList := Integer(EXGRIDLib_TLB.exShowExclude) Or Integer(EXGRIDLib_TLB.exShowFocusItem) Or Integer(EXGRIDLib_TLB.exShowCheckBox); end; with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); AddItem('Item 4'); end; with Columns.Item[OleVariant(0)] do begin FilterType := Integer(EXGRIDLib_TLB.exFilterExclude) Or Integer(EXGRIDLib_TLB.exFilter); Filter := 'Item 1|Item 4'; end; ApplyFilter(); EndUpdate(); end |
886 |
Using the property Column.FormatColumn I want to display numbers in the numeric format with no decimals - unless the value is NULL then I want to display a blank or empty
with Grid1 do begin BeginUpdate(); with Columns do begin (IUnknown(Add('Format')) as EXGRIDLib_TLB.Column).FormatColumn := 'len(value) ? (value format ''0'') : '''' '; end; with Items do begin AddItem(OleVariant(10)); AddItem(Null); AddItem(OleVariant(-8)); end; EndUpdate(); end |
885 |
How can I change the drop down filter background color
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; Background[EXGRIDLib_TLB.exBackColorFilter] := $ffffff; with (IUnknown(Columns.Add('Items')) as EXGRIDLib_TLB.Column) do begin DisplayFilterButton := True; DisplayFilterPattern := False; FilterList := Integer(EXGRIDLib_TLB.exShowFocusItem) Or Integer(EXGRIDLib_TLB.exShowCheckBox) Or Integer(EXGRIDLib_TLB.exSortItemsAsc) Or Integer(EXGRIDLib_TLB.exLeafItems); end; with Items do begin h := AddItem('Root 1'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); ExpandItem[h] := True; h := AddItem('Root 2'); InsertItem(h,Null,'Child 1'); InsertItem(h,Null,'Child 2'); InsertItem(h,Null,'Child 3'); ExpandItem[h] := True; end; EndUpdate(); end |
884 |
I am using AllowGroupBy property and calling the Column.SortOrder property groups by that column. Is it possible to prevent that, so I have a similar behavior like I click the column's header rather than dragging it to the control's GroupBy bar
with Grid1 do begin with Columns do begin Add('First'); Add('Second'); Add('Third'); end; SortBarVisible := True; SingleSort := False; AllowGroupBy := True; Layout := 'SingleSort = "C0:1";MultipleSort = "C1:2 C2:1"'; end |
883 |
Calling programatically the Column.SortOrder property adds the column to the sort bar. Is it possible to prevent that, so I have a similar behavior like I click the column's header rather than dragging it to the control's Sort bar
with Grid1 do begin with Columns do begin Add('First'); Add('Second'); Add('Third'); end; SortBarVisible := True; SingleSort := False; Layout := 'SingleSort = "C0:1"'; end |
882 |
How do I restore/clear the HotBackColor/HotForeColor properties
with Grid1 do begin BeginUpdate(); HotBackColor := RGB(0,0,255); HotForeColor := RGB(255,255,255); (IUnknown(Columns.Add('Value')) as EXGRIDLib_TLB.Column).Visible := False; with (IUnknown(Columns.Add('USD')) as EXGRIDLib_TLB.Column) do begin Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); FormatColumn := 'len(%0) ? ((0:=dbl(%0)) < 10 ? ''<fgcolor=808080><font ;7>'' : ''<b>'') + `USD `+ (=:0 format ``)'; end; with (IUnknown(Columns.Add('EUR')) as EXGRIDLib_TLB.Column) do begin Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); FormatColumn := 'len(%0) ? ((0:=0.72*dbl(%0)) < 10 ? ''<fgcolor=808080><font ;7>'' : ''<b>'') + `EUR `+ (=:0 format ``)'; end; with Items do begin AddItem('1.23'); AddItem('2.34'); AddItem('9.94'); AddItem('11.94'); AddItem('1000'); end; HotBackColor := BackColor; HotForeColor := ForeColor; EndUpdate(); end |
881 |
How do I format a column using a currency, and another column to another currency
with Grid1 do begin (IUnknown(Columns.Add('Value')) as EXGRIDLib_TLB.Column).Visible := False; with (IUnknown(Columns.Add('USD')) as EXGRIDLib_TLB.Column) do begin Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); FormatColumn := 'len(%0) ? ((0:=dbl(%0)) < 10 ? ''<fgcolor=808080><font ;7>'' : ''<b>'') + `USD `+ (=:0 format ``)'; end; with (IUnknown(Columns.Add('EUR')) as EXGRIDLib_TLB.Column) do begin Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); FormatColumn := 'len(%0) ? ((0:=0.72*dbl(%0)) < 10 ? ''<fgcolor=808080><font ;7>'' : ''<b>'') + `EUR `+ (=:0 format ``)'; end; with Items do begin AddItem('1.23'); AddItem('2.34'); AddItem('9.94'); AddItem('11.94'); AddItem('1000'); end; end |
880 |
How can I sort the columns to be displayed on the columns floating bar
with Grid1 do begin ColumnAutoResize := False; with Columns do begin (IUnknown(Add('City')) as EXGRIDLib_TLB.Column).Visible := False; (IUnknown(Add('Start')) as EXGRIDLib_TLB.Column).Visible := False; (IUnknown(Add('End')) as EXGRIDLib_TLB.Column).Visible := False; end; ColumnsFloatBarVisible := EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeHiddenColumns; ColumnsFloatBarSortOrder := EXGRIDLib_TLB.SortAscending; end |
879 |
How can I get the column index and the row index of the active cell
// FocusChanged event - Occurs when a new cell is focused. procedure TForm1.Grid1FocusChanged(ASender: TObject; ); begin with Grid1 do begin OutputDebugString( 'Active/Focus-Column:' ); OutputDebugString( Columns.Item[OleVariant(FocusColumnIndex)].Caption ); with Items do begin OutputDebugString( 'Active/Focus-Row/Item:' ); OutputDebugString( CellCaption[OleVariant(FocusItem),OleVariant(Grid1.FocusColumnIndex)] ); end; end end; with Grid1 do begin BeginUpdate(); with Columns do begin (IUnknown(Add('C1')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; (IUnknown(Add('C2')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; (IUnknown(Add('C3')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; end; with Items do begin h := AddItem(OleVariant(1)); CellValue[OleVariant(h),OleVariant(1)] := OleVariant(2); CellValue[OleVariant(h),OleVariant(2)] := OleVariant(3); h := AddItem(OleVariant(3)); CellValue[OleVariant(h),OleVariant(1)] := OleVariant(1); CellValue[OleVariant(h),OleVariant(2)] := OleVariant(2); end; EndUpdate(); end |
878 |
How can I add a vertical padding
with Grid1 do begin BeginUpdate(); DrawGridLines := EXGRIDLib_TLB.exAllLines; with (IUnknown(Columns.Add('Padding')) as EXGRIDLib_TLB.Column) do begin Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True); Def[EXGRIDLib_TLB.exCellSingleLine] := OleVariant(False); Def[EXGRIDLib_TLB.exCellPaddingLeft] := OleVariant(6); Def[EXGRIDLib_TLB.exCellPaddingRight] := OleVariant(6); Def[EXGRIDLib_TLB.exCellPaddingTop] := OleVariant(6); Def[EXGRIDLib_TLB.exCellPaddingBottom] := OleVariant(6); end; with Items do begin AddItem('padding'); AddItem('padding'); end; EndUpdate(); end |
877 |
How can I set item's height individually for every item in the control and also have line breaks in the item caption
with Grid1 do begin BackColorAlternate := RGB(240,240,240); with (IUnknown(Columns.Add('Lines')) as EXGRIDLib_TLB.Column) do begin Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); Def[EXGRIDLib_TLB.exCellSingleLine] := OleVariant(False); end; ItemsAllowSizing := EXGRIDLib_TLB.exResizeItem; with Items do begin h := AddItem('Line 1<br>Line 2'); ItemMinHeight[h] := 36; ItemHeight[h] := ItemMinHeight[h]; ItemMaxHeight[h] := ItemMinHeight[h]; h := AddItem('Line 1<br>Line 2'); ItemMinHeight[h] := 48; ItemHeight[h] := ItemMinHeight[h]; ItemMaxHeight[h] := ItemMinHeight[h]; h := AddItem('Line 1<br>Line 2'); ItemMinHeight[h] := 64; ItemHeight[h] := ItemMinHeight[h]; ItemMaxHeight[h] := ItemMinHeight[h]; end; end |
876 |
The mouse-cursor is shown over the tooltip. Is it possible somehow resolve this (method 2)
// MouseMove event - Occurs when the user moves the mouse. procedure TForm1.Grid1MouseMove(ASender: TObject; Button : Smallint;Shift : Smallint;X : Integer;Y : Integer); begin with Grid1 do begin ShowToolTip('This is bit of text that''s shown when the user hovers the cell','Column',OleVariant(0),'+16','+16'); end end; with Grid1 do begin Columns.Add('Column'); with Items do begin AddItem('tooltip'); end; end |
875 |
The mouse-cursor is shown over the tooltip. Is it possible somehow resolve this (method 1)
|
874 |
How can I add a MIN or MAX field (for date)
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Text')) as EXGRIDLib_TLB.Column).SortType := EXGRIDLib_TLB.SortDate; with Items do begin AddItem('1/1/2001'); AddItem('12/11/1998'); AddItem('1/20/2014'); AddItem('1/1/2013'); h := AddItem('min(all,dir,date(%0))'); SortableItem[h] := False; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''MIN: ''+value'; h := AddItem('max(all,dir,date(%0))'); SortableItem[h] := False; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''MAX: ''+value'; end; EndUpdate(); end |
873 |
How can I add a MIN or MAX field (for text)
with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Text')) as EXGRIDLib_TLB.Column).SortType := EXGRIDLib_TLB.SortString; with Items do begin AddItem('aha'); AddItem('baba'); AddItem('aaha'); AddItem('aka'); h := AddItem('min(all,dir,str(%0))'); SortableItem[h] := False; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''MIN: ''+value'; h := AddItem('max(all,dir,str(%0))'); SortableItem[h] := False; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exTotalField; CellHAlignment[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.RightAlignment; FormatCell[OleVariant(h),OleVariant(0)] := '''MAX: ''+value'; end; EndUpdate(); end |
872 |
How can I change the the focus rectangle
with Grid1 do begin BeginUpdate(); VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABeEGACAADACAxRDgMQBQKAAzQFAYbBlBaERiGQYIJhUAIIRZGMQxXAcMQvDSKQJhGDAADENAxAJCI4DBIgZQNDwZQIkCY4ZDKHIfRzNAASJI' + 'kTQPBKfYDGOLhSh6IJGRpPEIxdJMBr+fZ9QApeoYVj2J4eUCAFBxDRsZw8BiNAbkOi4Jp1f5nVJaFSxCKoSxbNqSBpGCzoJrKdI0R5JES2BAddTLBKzX7tHArLgSJ5dS' + 'rLMrwSKcRR1HSbIDyGaMUiCSqGVjWNZ5FREM46AAGbDgMILEgOZpoYDFVTZTKFCS7I6Eb40CCbCyPJQAabgWo4KAAZThNi7QAua4bTr7HqibLAexaJDOc4HVSgMLlIYE' + 'kIeg2iybAjDkfhMFuHY7mQT4xB0TBnFoUQ6i+cg2j2SIvHqVZIl8cB+BwTgPA4NRdjycg2FoHhuAMUZuHGUAwCECQUAaEYMHQHRHCGFRZEQAABO2AwRFCWQJAoGxECWT' + 'BHkGBxpg8RhYBMbJbD+TBzByfwwAwCIOCWCQiGiJgogqYh4hYIQ/k2cx9gEYQAAiRgqgsYx4mYLIOiOCMjjCTA4iScw8mMOQWEaEZkGkDgpguUIYm4SITmUCQaDuExjg' + 'kRhWhQJQ0A4ToVmWSQWFkAAljkdhiheZgZgoXIZCUWYaF2GgihmKhrg4JRJjYboVmaSIiHOHQnAkahph2ZYJmQAAxAwSQKESHwkFkKgoiAIxIHoPIimOOg2DiCgoiQJR' + 'QTYQxwn8MgMgoMoPiaYoaGCfw4A4CJNAkOpcGQBCAg=='); Background[EXGRIDLib_TLB.exShowFocusRect] := $1000000; with (IUnknown(Columns.Add('Check')) as EXGRIDLib_TLB.Column) do begin Def[EXGRIDLib_TLB.exCellPaddingLeft] := OleVariant(2); Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True); end; SelForeColor := ForeColor; SelBackColor := BackColor; DefaultItemHeight := 22; ShowFocusRect := True; with Items do begin AddItem(''); AddItem(''); end; EndUpdate(); end |
871 |
Can each cell have their own dropdown lists that contain "different list item values" for each cell, not predefined for the entire column
with Grid1 do begin BeginUpdate(); with (IUnknown(Columns.Add('Column/Cell-Same')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.DropDownListType; AddItem(0,'Zero',Null); AddItem(1,'One',Null); AddItem(2,'Two',Null); end; with (IUnknown(Columns.Add('Column/Cell-Different')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.EditType; end; with Items do begin AddItem(Null); h := AddItem(OleVariant(0)); with CellEditor[OleVariant(h),OleVariant(1)] do begin EditType := EXGRIDLib_TLB.DropDownListType; AddItem(3,'Three',Null); AddItem(4,'Four',Null); end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(3); AddItem(Null); h := AddItem(OleVariant(0)); with CellEditor[OleVariant(h),OleVariant(1)] do begin EditType := EXGRIDLib_TLB.CheckListType; AddItem(1,'Single',Null); AddItem(2,'Double',Null); end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(3); end; EndUpdate(); end |
870 |
How can I specify just a few fonts in a FontType editor
with Grid1 do begin BeginUpdate(); DefaultItemHeight := 22; DrawGridLines := EXGRIDLib_TLB.exRowLines; with (IUnknown(Columns.Add('Fonts')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.FontType; ClearItems(); AddItem(0,'Calibri',Null); AddItem(1,'Arial',Null); AddItem(2,'Rockwell',Null); AddItem(3,'Tahoma',Null); SortItems(OleVariant(True),Null); DropDownRows := 4; end; with Items do begin AddItem('Tahoma'); end; EndUpdate(); end |
869 |
How do you embed HTML options into the anchor click string
// AnchorClick event - Occurs when an anchor element is clicked. procedure TForm1.Grid1AnchorClick(ASender: TObject; AnchorID : WideString;Options : WideString); begin with Grid1 do begin OutputDebugString( AnchorID ); OutputDebugString( Options ); end end; with Grid1 do begin BeginUpdate(); with Columns do begin (IUnknown(Add('Car')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); end; with Items do begin AddItem('<a mazda_1;options for 1>Mazda <b>1</b></a>'); AddItem('<a mazda_2;options for 2>Mazda <b>2</b></a>'); AddItem('<a mazda_3;options for 3a>Mazda <b>3.a</b></a>'); AddItem('<a mazda_3;options for 3b>Mazda <b>3.b</b></a>'); end; EndUpdate(); end |
868 |
How do I add a checkbox column (method 2)
// CellStateChanged event - Fired after cell's state has been changed. procedure TForm1.Grid1CellStateChanged(ASender: TObject; Item : HITEM;ColIndex : Integer); begin with Grid1 do begin OutputDebugString( 'CheckBox Changed:' ); OutputDebugString( Items.CellState[OleVariant(Item),OleVariant(ColIndex)] ); end end; with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Check')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True); with Items do begin CellState[OleVariant(AddItem('Check 1')),OleVariant(0)] := 0; CellState[OleVariant(AddItem('Check 2')),OleVariant(0)] := 1; CellState[OleVariant(AddItem('Check 3')),OleVariant(0)] := 0; CellState[OleVariant(AddItem('Check 4')),OleVariant(0)] := 1; end; EndUpdate(); end |
867 |
How do I add a checkbox column (method 1)
// Change event - Occurs when the user changes the cell's content. procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant); begin with Grid1 do begin OutputDebugString( 'CheckBox Changed:' ); OutputDebugString( NewValue ); end end; with Grid1 do begin BeginUpdate(); with (IUnknown(Columns.Add('Check')) as EXGRIDLib_TLB.Column) do begin with Editor do begin EditType := EXGRIDLib_TLB.CheckValueType; Option[EXGRIDLib_TLB.exCheckValue2] := OleVariant(1); end; end; with Items do begin AddItem(OleVariant(0)); AddItem(OleVariant(1)); AddItem(OleVariant(0)); AddItem(OleVariant(1)); end; EndUpdate(); end |
866 |
How do I change the progress bar's appearance
with Grid1 do begin with VisualAppearance do begin Add(1,'c:\exontrol\images\normal.ebn'); Add(2,'c:\exontrol\images\pushed.ebn'); end; var_Editor := (IUnknown(Columns.Add('Progress')) as EXGRIDLib_TLB.Column).Editor; with var_Editor do begin EditType := EXGRIDLib_TLB.ProgressBarType; Option[EXGRIDLib_TLB.exProgressBarBackColor] := OleVariant(16777216); Option[EXGRIDLib_TLB.exProgressBarMarkTicker] := OleVariant(33554432); end; Items.AddItem(OleVariant(33)); end |
865 |
I have the rows with different background color, and when I select the item it takes the color of the SelBackColor, and therefore is no longer visible behind the color. Is there any option to make the item's color being visible (method 3)
with Grid1 do begin BeginUpdate(); VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAEGg4BVEIQAAYAQGKIYBkAKBQAGaAoDDMOQwQwAAxjGKEEwsACEIrjKCRShyCYZRhGcTSBCIZBqEqSZLiEZRQCWIAzATGYBRfIUEgjBM6ExwG78eg' + 'BHp/ZpkACIJJAaRjHQdJxGKKMQB9DIhCZpeKhWgkKIJBzOEyBRC4ERBGqNGrsIgLEqWZpnWhaNpWXYTLyBN64LhuK46g53O6wLxvK6hEr2dJ/YBcIAOfghf4NQ7EMRxL' + 'C8Mw3BDvYDkOAABAIgI='); SelBackColor := $1fffffe; ShowFocusRect := False; Columns.Add('Items'); with Items do begin ItemBackColor[AddItem('red')] := $ff; ItemBackColor[AddItem('blue')] := $ff0000; ItemBackColor[AddItem('green')] := $ff00; end; EndUpdate(); end |
864 |
I have the rows with different background color, and when I select the item it takes the color of the SelBackColor, and therefore is no longer visible behind the color. Is there any option to make the item's color being visible (method 2)
with Grid1 do begin BeginUpdate(); SelBackMode := EXGRIDLib_TLB.exTransparent; ShowFocusRect := False; Columns.Add('Items'); with Items do begin ItemBackColor[AddItem('red')] := $ff; ItemBackColor[AddItem('blue')] := $ff0000; ItemBackColor[AddItem('green')] := $ff00; end; EndUpdate(); end |
863 |
I have the rows with different background color, and when I select the item it takes the color of the SelBackColor, and therefore is no longer visible behind the color. Is there any option to make the item's color being visible (method 1)
with Grid1 do begin BeginUpdate(); SelBackColor := BackColor; SelForeColor := ForeColor; ShowFocusRect := True; Columns.Add('Items'); with Items do begin ItemBackColor[AddItem('red')] := $ff; ItemBackColor[AddItem('blue')] := $ff0000; ItemBackColor[AddItem('green')] := $ff00; end; EndUpdate(); end |
862 |
The BeforeExpandItem event is fired when clicking the drop down filter button. What we can do to prevent that
// BeforeExpandItem event - Fired before an item is about to be expanded (collapsed). procedure TForm1.Grid1BeforeExpandItem(ASender: TObject; Item : HITEM;var Cancel : OleVariant); begin with Grid1 do begin OutputDebugString( 'BeforeExpandItem' ); OutputDebugString( Item ); Items.InsertItem(Item,Null,'new child'); end end; with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; with Columns do begin with (IUnknown(Add('Items')) as EXGRIDLib_TLB.Column) do begin DisplayFilterButton := True; FilterList := EXGRIDLib_TLB.exRootItems; end; end; with Items do begin ItemHasChildren[InsertItem(Null,Null,'Group 1')] := True; ItemHasChildren[InsertItem(Null,Null,'Group 2')] := True; end; EndUpdate(); end |
861 |
How can I change the shape of the line to be shown when user drag and drop data over the control, EBN
// OLEStartDrag event - Occurs when the OLEDrag method is called. procedure TForm1.Grid1OLEStartDrag(ASender: TObject; Data : IExDataObject;var AllowedEffects : Integer); begin // Data.SetData("data to be dragged") end; with Grid1 do begin OLEDropMode := EXGRIDLib_TLB.exOLEDropManual; VisualAppearance.Add(1,'C:\Program Files\Exontrol\ExList\Sample\VB\DragDrop\insert_bottom.ebn'); Background[EXGRIDLib_TLB.exListOLEDropPosition] := $1000000; Columns.Add('Default'); with Items do begin AddItem('Item 1'); AddItem('Item 2'); end; end |
860 |
How can I highlight the item from cursor when the user drag and drop data over the control
// OLEStartDrag event - Occurs when the OLEDrag method is called. procedure TForm1.Grid1OLEStartDrag(ASender: TObject; Data : IExDataObject;var AllowedEffects : Integer); begin // Data.SetData("data to be dragged") end; with Grid1 do begin OLEDropMode := EXGRIDLib_TLB.exOLEDropManual; Background[EXGRIDLib_TLB.exListOLEDropPosition] := $1; Columns.Add('Default'); with Items do begin AddItem('Item 1'); AddItem('Item 2'); end; end |
859 |
Is it possible to always show the editor for all cells at all times
// AddItem event - Occurs after a new Item has been inserted to Items collection. procedure TForm1.Grid1AddItem(ASender: TObject; Item : HITEM); begin with Grid1 do begin Items.CellEditorVisible[OleVariant(Item),OleVariant(0)] := EXGRIDLib_TLB.exEditorVisible; Items.CellEditorVisible[OleVariant(Item),OleVariant(1)] := EXGRIDLib_TLB.exEditorVisible; end end; // EditOpen event - Occurs when the edit operation starts. procedure TForm1.Grid1EditOpen(ASender: TObject; ); begin with Grid1 do begin with Items do begin v := CellValue[OleVariant(FocusItem),OleVariant(0)]; c := CellCaption[OleVariant(FocusItem),OleVariant(0)]; end; with Columns.Item[OleVariant(1)].Editor do begin ClearItems(); AddItem(v,c,Null); end; end end; with Grid1 do begin BeginUpdate(); with (IUnknown(Columns.Add('DropDownList')) as EXGRIDLib_TLB.Column) do begin with Editor do begin EditType := EXGRIDLib_TLB.DropDownListType; AddItem(1,'First',Null); AddItem(2,'Second',Null); AddItem(3,'Third',Null); end; end; DrawGridLines := EXGRIDLib_TLB.exAllLines; (IUnknown(Columns.Add('DropDownList-Related')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.DropDownListType; with Items do begin CellValue[OleVariant(AddItem(OleVariant(1))),OleVariant(1)] := OleVariant(-1); CellValue[OleVariant(AddItem(OleVariant(2))),OleVariant(1)] := OleVariant(-1); CellValue[OleVariant(AddItem(OleVariant(3))),OleVariant(1)] := OleVariant(-1); LockedItemCount[EXGRIDLib_TLB.exBottom] := 1; h := LockedItem[EXGRIDLib_TLB.exBottom,0]; ItemDivider[h] := 0; ItemDividerLineAlignment[h] := EXGRIDLib_TLB.DividerTop; CellEditorVisible[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exEditorHidden; CellSingleLine[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exCaptionWordWrap; CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exHTML; CellValue[OleVariant(h),OleVariant(0)] := 'The drop down editor in the second column is filled during the <b>EditOpen event</b>, and the values are based on the selection ' + 'on the first column.'; end; EndUpdate(); end |
858 |
How do I set a computated cell individually
with Grid1 do begin BeginUpdate(); Columns.Add('Number'); Columns.Add('Format'); with Items do begin h := AddItem('1.23'); CellValueFormat[OleVariant(h),OleVariant(1)] := Integer(EXGRIDLib_TLB.exComputedField) Or Integer(EXGRIDLib_TLB.exHTML); CellValue[OleVariant(h),OleVariant(1)] := '2 * %0 + ` <font ;6><fgcolor=808080>(2 * Number)`'; h := AddItem('1.23'); CellValueFormat[OleVariant(h),OleVariant(1)] := Integer(EXGRIDLib_TLB.exComputedField) Or Integer(EXGRIDLib_TLB.exHTML); CellValue[OleVariant(h),OleVariant(1)] := '3 * %0 + ` <font ;6><fgcolor=808080>(3 * Number)`'; h := AddItem('1.23'); CellValueFormat[OleVariant(h),OleVariant(1)] := Integer(EXGRIDLib_TLB.exComputedField) Or Integer(EXGRIDLib_TLB.exHTML); CellValue[OleVariant(h),OleVariant(1)] := 'currency(%0) + ` <font ;6><fgcolor=808080>( Currency(Number) )`'; end; EndUpdate(); end |
857 |
Is it possible to assign a different editor for some cells
with Grid1 do begin with (IUnknown(Columns.Add('Column - DropDownList')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.DropDownListType; AddItem(1,'First item',Null); AddItem(2,'Second item',Null); AddItem(3,'Third item',Null); end; (IUnknown(Columns.Add('Cell - DropDownList')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); with Items do begin h := AddItem(OleVariant(1)); with CellEditor[OleVariant(h),OleVariant(1)] do begin EditType := EXGRIDLib_TLB.DropDownListType; AddItem(1,'<b>First</b> item',Null); AddItem(2,'<b>Second</b> item',Null); AddItem(3,'<b>Third</b> item',Null); AddItem(4,'<b>Forth</b> item',Null); end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(2); h := AddItem(OleVariant(2)); with CellEditor[OleVariant(h),OleVariant(1)] do begin EditType := EXGRIDLib_TLB.DropDownListType; AddItem(1,'<b>Aka First</b> item',Null); AddItem(2,'<b>Aka Second</b> item',Null); AddItem(3,'<b>Aka Third</b> item',Null); AddItem(4,'<b>Aka Forth</b> item',Null); end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(2); end; end |
856 |
Is it possible to define the keys of the drop down values to be strings rather than numeric values
// Change event - Occurs when the user changes the cell's content. procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant); begin with Grid1 do begin OutputDebugString( 'NewValue is' ); OutputDebugString( NewValue ); end end; with Grid1 do begin with (IUnknown(Columns.Add('DropDownList-String')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.DropDownListType; AddItem(1,'NYC|New York City',Null); AddItem(2,'CJN|Cluj Napoca',Null); end; with (IUnknown(Columns.Add('DropDownList-Numeric')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.DropDownListType; AddItem(1,'New York City',Null); AddItem(2,'Cluj Napoca',Null); end; with Items do begin CellValue[OleVariant(AddItem('NYC')),OleVariant(1)] := OleVariant(2); end; end |
855 |
The Change event gets me the today date. How can I find what user typed
// Change event - Occurs when the user changes the cell's content. procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM;ColIndex : Integer;var NewValue : OleVariant); begin with Grid1 do begin OutputDebugString( 'NewValue:' ); OutputDebugString( NewValue ); OutputDebugString( 'EditingValue:' ); OutputDebugString( EditingText ); end end; with Grid1 do begin BeginUpdate(); (IUnknown(Columns.Add('Edit')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.DateType; Items.AddItem('1/1/2001'); EndUpdate(); end |
854 |
I have an edit field, when going to edit mode, the rightmost part is shown. Is it possible to show the left part instead
with Grid1 do begin BeginUpdate(); with (IUnknown(Columns.Add('Edit')) as EXGRIDLib_TLB.Column) do begin Width := 64; AllowSizing := False; with Editor do begin EditType := EXGRIDLib_TLB.MaskType; Mask := ';;;rich'; end; end; Columns.Add('Empty'); with Items do begin AddItem('This is a bit ot long text'); AddItem(''); end; EndUpdate(); end |
853 |
I have a drop down field, the control shows the rightmost part of the selected caption. Is it possible to show the left part
with Grid1 do begin BeginUpdate(); with (IUnknown(Columns.Add('DropDown')) as EXGRIDLib_TLB.Column) do begin Width := 64; AllowSizing := False; with Editor do begin DropDownAlignment := EXGRIDLib_TLB.AlignmentEnum($20); EditType := EXGRIDLib_TLB.DropDownType; AddItem(1,'First item. This is a bit ot long text',Null); AddItem(2,'Second item. This is a bit ot long text',Null); AddItem(3,'Third item. This is a bit ot long text',Null); Mask := ';;;rich'; end; end; with (IUnknown(Columns.Add('PickEdit')) as EXGRIDLib_TLB.Column) do begin Width := 64; AllowSizing := False; with Editor do begin DropDownAlignment := EXGRIDLib_TLB.AlignmentEnum($20); EditType := EXGRIDLib_TLB.PickEditType; AddItem(1,'First item. This is a bit ot long text',Null); AddItem(2,'Second item. This is a bit ot long text',Null); AddItem(3,'Third item. This is a bit ot long text',Null); Mask := ';;;rich'; end; end; Columns.Add('Empty'); with Items do begin CellValue[OleVariant(AddItem('First item. This is a bit ot long text')),OleVariant(1)] := 'Second item. This is a bit ot long text'; h := AddItem('First item. This is a bit ot long text'); with CellEditor[OleVariant(h),OleVariant(0)] do begin DropDownAlignment := EXGRIDLib_TLB.AlignmentEnum($20); EditType := EXGRIDLib_TLB.DropDownType; AddItem(1,'First item. This is a bit ot long text',Null); AddItem(2,'Second item. This is a bit ot long text',Null); AddItem(3,'Third item. This is a bit ot long text',Null); end; CellValue[OleVariant(h),OleVariant(1)] := 'Second item. This is a bit ot long text'; with CellEditor[OleVariant(h),OleVariant(1)] do begin DropDownAlignment := EXGRIDLib_TLB.AlignmentEnum($20); EditType := EXGRIDLib_TLB.PickEditType; AddItem(1,'First item. This is a bit ot long text',Null); AddItem(2,'Second item. This is a bit ot long text',Null); AddItem(3,'Third item. This is a bit ot long text',Null); end; end; EndUpdate(); end |
852 |
Is there a property for the back color of the dropdown field
with Grid1 do begin BeginUpdate(); with (IUnknown(Columns.Add('Date')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.DateType; Option[EXGRIDLib_TLB.exDropDownBackColor] := OleVariant(15790320); Option[EXGRIDLib_TLB.exDropDownForeColor] := OleVariant(65793); end; Items.AddItem('1/1/2001'); EndUpdate(); end |
851 |
Is it possible to change a back color of the field/cell when it takes a focus
// EditClose event - Occurs when the edit operation ends. procedure TForm1.Grid1EditClose(ASender: TObject; ); begin with Grid1 do begin with Items do begin ClearCellBackColor(OleVariant(FocusItem),OleVariant(Grid1.FocusColumnIndex)); end; end end; // EditOpen event - Occurs when the edit operation starts. procedure TForm1.Grid1EditOpen(ASender: TObject; ); begin with Grid1 do begin with Items do begin CellBackColor[OleVariant(FocusItem),OleVariant(Grid1.FocusColumnIndex)] := $ff; end; with Items do begin CellValue[OleVariant(FocusItem),OleVariant(Grid1.FocusColumnIndex)] := Grid1.Items.CellValue[OleVariant(Grid1.Items.FocusItem),OleVariant(Grid1.FocusColumnIndex)]; end; end end; with Grid1 do begin FullRowSelect := EXGRIDLib_TLB.exColumnSel; (IUnknown(Columns.Add('C1')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; (IUnknown(Columns.Add('C2')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType; with Items do begin CellValue[OleVariant(AddItem('v1')),OleVariant(1)] := 'v2'; CellValue[OleVariant(AddItem('v3')),OleVariant(1)] := 'v4'; end; end |
850 |
How can I display the current date mask, but still allow empty values
with Grid1 do begin BeginUpdate(); CauseValidateValue := EXGRIDLib_TLB.exValidateCell; FullRowSelect := EXGRIDLib_TLB.exColumnSel; DrawGridLines := EXGRIDLib_TLB.exRowLines; with (IUnknown(Columns.Add('Date')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.DateType; Mask := '!99/99/9999;1;;empty=1,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,' + 'select=4,overtype'; end; with Items do begin AddItem(Null); AddItem('1/1/2001'); AddItem(Null); end; EndUpdate(); end |
849 |
How can I align the days in a DateType editor
with Grid1 do begin Columns.Add('DropDown'); with Items do begin with CellEditor[OleVariant(AddItem('1/1/2001')),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; DropDownAlignment := EXGRIDLib_TLB.RightAlignment; end; with CellEditor[OleVariant(AddItem('1/1/2001')),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; DropDownAlignment := EXGRIDLib_TLB.CenterAlignment; end; with CellEditor[OleVariant(AddItem('1/1/2001')),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; DropDownAlignment := EXGRIDLib_TLB.LeftAlignment; end; with CellEditor[OleVariant(AddItem('1/1/2001')),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; DropDownAlignment := EXGRIDLib_TLB.AlignmentEnum($20); end; with CellEditor[OleVariant(AddItem('1/1/2001')),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; DropDownAlignment := EXGRIDLib_TLB.AlignmentEnum($20 Or Integer(EXGRIDLib_TLB.CenterAlignment)); end; with CellEditor[OleVariant(AddItem('1/1/2001')),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; DropDownAlignment := EXGRIDLib_TLB.AlignmentEnum($20 Or Integer(EXGRIDLib_TLB.RightAlignment)); end; end; end |
848 |
How can I align the drop down portion rather the inside captions
with Grid1 do begin (IUnknown(Columns.Add('DropDown')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.DateType; with Items do begin with CellEditor[OleVariant(AddItem('1/1/2001')),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; DropDownAlignment := EXGRIDLib_TLB.AlignmentEnum($20); end; with CellEditor[OleVariant(AddItem('1/1/2001')),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; DropDownAlignment := EXGRIDLib_TLB.AlignmentEnum($10); end; AddItem('1/1/2001'); end; end |
847 |
Is it possible to show a message that the field is empty
with Grid1 do begin DrawGridLines := EXGRIDLib_TLB.exRowLines; FullRowSelect := EXGRIDLib_TLB.exColumnSel; with (IUnknown(Columns.Add('Float')) as EXGRIDLib_TLB.Column) do begin with Editor do begin EditType := EXGRIDLib_TLB.MaskType; Mask := ';;;float,digits=0,grouping=,invalid=empty,warning=invalid character'; end; end; Items.AddItem(OleVariant(192278)); Items.AddItem(OleVariant(1000)); end |
846 |
How can I mask a date
with Grid1 do begin BeginUpdate(); CauseValidateValue := EXGRIDLib_TLB.exValidateCell; FullRowSelect := EXGRIDLib_TLB.exColumnSel; DrawGridLines := EXGRIDLib_TLB.exRowLines; Columns.Add('Date'); Columns.Add('Mask'); with Items do begin h := AddItem('1/1/2001'); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; Mask := '{1,12}/{1,31}/{1950,2050};1;;select=1,warning=Invalid character!,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>' + '!,validateas=1'; end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(CellEditor[OleVariant(h),OleVariant(0)].Mask); h := AddItem('1/1/2001'); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; Mask := '!99/99/9999;1;;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,se' + 'lect=4,overtype'; end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(CellEditor[OleVariant(h),OleVariant(0)].Mask); h := AddItem('1/1/2001'); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; Mask := '!99/99/9999;;;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,sel' + 'ect=4,overtype'; end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(CellEditor[OleVariant(h),OleVariant(0)].Mask); h := AddItem('1/1/2001'); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; Mask := '!99/99/9999;; ;select=4,overtype,empty,warning=Invalid character!,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b' + '>!,validateas=1'; end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(CellEditor[OleVariant(h),OleVariant(0)].Mask); h := AddItem('1/1/2001'); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; Mask := '![0-9 ][0-9 ]/[0-9 ][0-9 ]/[0-9 ][0-9 ][0-9 ][0-9 ];1;;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%ma' + 'sk%>''</b>!,warning=Invalid character!,select=4,leading= '; end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(CellEditor[OleVariant(h),OleVariant(0)].Mask); h := AddItem('1/1/2001'); FormatCell[OleVariant(h),OleVariant(0)] := 'len(value) ? shortdateF(value) : ``'; with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; Mask := '!99/99/9999;1;;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,se' + 'lect=4,overtype,leading'; end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(CellEditor[OleVariant(h),OleVariant(0)].Mask); h := AddItem('1/1/2001'); FormatCell[OleVariant(h),OleVariant(0)] := 'len(value) ? shortdateF(value) : ``'; with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; Mask := '!00/00/0000;1;;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,se' + 'lect=4,overtype,leading'; end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(CellEditor[OleVariant(h),OleVariant(0)].Mask); h := AddItem('1/1/2001'); FormatCell[OleVariant(h),OleVariant(0)] := 'len(value) ? shortdateF(value) : ``'; with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; Mask := '!00/00/0000;;0;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,se' + 'lect=4,overtype'; end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(CellEditor[OleVariant(h),OleVariant(0)].Mask); h := AddItem('1/1/2001'); FormatCell[OleVariant(h),OleVariant(0)] := 'len(value) ? shortdateF(value) : ``'; with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.DateType; Mask := '!00/00/0000;;;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,sel' + 'ect=1,overtype'; end; CellValue[OleVariant(h),OleVariant(1)] := OleVariant(CellEditor[OleVariant(h),OleVariant(0)].Mask); end; EndUpdate(); end |
845 |
How can I display and edit an integer number to show grouping digits too ( no decimals)
with Grid1 do begin with (IUnknown(Columns.Add('Float')) as EXGRIDLib_TLB.Column) do begin FormatColumn := 'value format `0`'; with Editor do begin EditType := EXGRIDLib_TLB.MaskType; Mask := ';;;float,digits=0'; end; end; Items.AddItem(OleVariant(192278)); end |
844 |
How can I display and edit a float number to show grouping digits too
with Grid1 do begin with (IUnknown(Columns.Add('Float')) as EXGRIDLib_TLB.Column) do begin FormatColumn := 'value format ``'; with Editor do begin EditType := EXGRIDLib_TLB.MaskType; Mask := ';;;float'; end; end; Items.AddItem(OleVariant(192278)); end |
843 |
How can I mask a phone number
with Grid1 do begin CauseValidateValue := EXGRIDLib_TLB.exValidateCell; DrawGridLines := EXGRIDLib_TLB.exRowLines; FullRowSelect := EXGRIDLib_TLB.exColumnSel; (IUnknown(Columns.Add('Phone')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.MaskType; with Items do begin h := AddItem(Null); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.MaskType; Mask := '!(999) 000 0000;1;;select=1,empty,overtype,warning=invalid characer,invalid=The value you entered isn''t appropriate for the inpu' + 't mask <b>''<%mask%>''</b> specified for this field.'; end; h := AddItem('0123'); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.MaskType; Mask := '!(999) 000 0000;2;;select=4'; end; h := AddItem('0123'); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.MaskType; Mask := '`Phone: `!(999) 000-0000'; end; h := AddItem('(074) 876-1222'); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.MaskType; Mask := '!(999) 000-0000;0'; end; end; end |
842 |
Is it possible to display the ColorType fields using RGB format
with Grid1 do begin (IUnknown(Columns.Add('Color')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.ColorType; with Items do begin AddItem(OleVariant(255)); h := AddItem(OleVariant(255)); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.ColorType; Mask := '`RGB(`{0,255}\,{0,255}\,{0,255}`)`;;0'; end; h := AddItem(OleVariant(255)); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.ColorType; Mask := '`&H`XXXXXXXX`&`;;0;overtype,insertype,warning=Wrong!'; end; h := AddItem(OleVariant(255)); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.ColorType; Mask := '`0x`XX `0x`XX `0x`XX;;0;overtype,insertype,warning=Wrong!'; end; h := AddItem(OleVariant(255)); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.ColorType; Mask := 'R{0,255} G{0,255} B{0,255};;0;overtype,insertype,warning=Wrong!'; end; h := AddItem(OleVariant(255)); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.ColorType; Mask := '`(hexa) RGB 0x`XXXXXX;;0;overtype,insertype,warning=Wrong!'; end; h := AddItem(OleVariant(255)); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.ColorType; Mask := '`(decimal) Red: `{0,255}` Green: `{0,255}` Blue: `{0,255};;0;overtype,insertype,warning=Wrong!'; end; h := AddItem(OleVariant(255)); with CellEditor[OleVariant(h),OleVariant(0)] do begin EditType := EXGRIDLib_TLB.ColorType; Mask := '`(combine) Red: `{0,255}` Green: 0x`XX` Blue: `{0,255};;0;overtype,insertype,warning=Wrong!'; end; end; end |
841 |
How can I add the ExComboBox as an user editor
// UserEditorClose event - Fired the user editor is about to be opened. procedure TForm1.Grid1UserEditorClose(ASender: TObject; Object : IDispatch;Item : HITEM;ColIndex : Integer); begin // Items.CellValue(Item,ColIndex) = Object.Value end; // UserEditorOleEvent event - Occurs when an user editor fires an event. procedure TForm1.Grid1UserEditorOleEvent(ASender: TObject; Object : IDispatch;Ev : IOleEvent;var CloseEditor : WordBool;Item : HITEM;ColIndex : Integer); begin with Grid1 do begin OutputDebugString( Ev ); end end; // UserEditorOpen event - Occurs when an user editor is about to be opened. procedure TForm1.Grid1UserEditorOpen(ASender: TObject; Object : IDispatch;Item : HITEM;ColIndex : Integer); begin // Object.Value = Me.Items.CellValue(Item,ColIndex) end; with Grid1 do begin BeginUpdate(); with (IUnknown(Columns.Add('Exontrol.ComboBox')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.UserEditorType; UserEditor('Exontrol.ComboBox',''); with UserEditorObject do begin end; end; DrawGridLines := EXGRIDLib_TLB.exRowLines; DefaultItemHeight := 21; with Items do begin CellEditorVisible[OleVariant(AddItem(OleVariant(10248))),OleVariant(0)] := EXGRIDLib_TLB.exEditorVisible; CellEditorVisible[OleVariant(AddItem(OleVariant(10249))),OleVariant(0)] := EXGRIDLib_TLB.exEditorVisible; CellEditorVisible[OleVariant(AddItem(OleVariant(10250))),OleVariant(0)] := EXGRIDLib_TLB.exEditorVisible; end; EndUpdate(); end |
840 |
How can I add a header row
with Grid1 do begin ShowLockedItems := True; DrawGridLines := EXGRIDLib_TLB.exVLines; Columns.Add('C1'); Columns.Add('C2'); with Items do begin LockedItemCount[EXGRIDLib_TLB.exTop] := 1; h := LockedItem[EXGRIDLib_TLB.exTop,0]; ItemBackColor[h] := $808080; ItemForeColor[h] := $ffffff; CellValue[OleVariant(h),OleVariant(0)] := 'footer c1'; CellValue[OleVariant(h),OleVariant(1)] := 'footer c2'; CellValue[OleVariant(AddItem('cell')),OleVariant(1)] := 'cell'; end; end |
839 |
How can I add a footer row
with Grid1 do begin ShowLockedItems := True; DrawGridLines := EXGRIDLib_TLB.exVLines; Columns.Add('C1'); Columns.Add('C2'); with Items do begin LockedItemCount[EXGRIDLib_TLB.exBottom] := 1; h := LockedItem[EXGRIDLib_TLB.exBottom,0]; ItemBackColor[h] := $808080; ItemForeColor[h] := $ffffff; CellValue[OleVariant(h),OleVariant(0)] := 'footer c1'; CellValue[OleVariant(h),OleVariant(1)] := 'footer c2'; CellValue[OleVariant(AddItem('cell')),OleVariant(1)] := 'cell'; end; end |
838 |
How can I programmatically add more columns to the sort bar and other to be sorted, but not included in the sort bar
|
837 |
How can I fix a column, while other sizable and fill the control's client
with Grid1 do begin ColumnAutoResize := True; Columns.Add('Sizable'); with (IUnknown(Columns.Add('F')) as EXGRIDLib_TLB.Column) do begin AllowSizing := False; Width := 16; end; end |
836 |
Is it possible to use empty values on a PickEditType editor (method 2)
with Grid1 do begin with (IUnknown(Columns.Add('DropDown')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.PickEditType; AddItem(0,'',Null); AddItem(1,'The first item',Null); AddItem(2,'The second item',Null); AddItem(3,'The third item',Null); end; with Items do begin AddItem('The first item'); AddItem(''); AddItem('The third item'); end; end |
835 |
Is it possible to use empty values on a PickEditType editor (method 1)
with Grid1 do begin with (IUnknown(Columns.Add('DropDown')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.PickEditType; Option[EXGRIDLib_TLB.exPickAllowEmpty] := OleVariant(True); AddItem(1,'The first item',Null); AddItem(2,'The second item',Null); AddItem(3,'The third item',Null); end; with Items do begin AddItem('The first item'); AddItem(''); AddItem('The third item'); end; end |
834 |
How can I specify an unselectable cell
with Grid1 do begin BeginUpdate(); with Columns do begin Add('C1'); Add('C2'); Add('C3'); end; with Items do begin h := AddItem('unselectable item'); CellValue[OleVariant(h),OleVariant(1)] := 'unselectable item'; CellValue[OleVariant(h),OleVariant(2)] := 'unselectable item'; SelectableItem[h] := False; h := AddItem('selectable cell'); CellValue[OleVariant(h),OleVariant(1)] := 'unselectable cell'; CellEnabled[OleVariant(h),OleVariant(1)] := False; CellForeColor[OleVariant(h),OleVariant(1)] := $0; CellValue[OleVariant(h),OleVariant(2)] := 'disabled cell'; CellEnabled[OleVariant(h),OleVariant(2)] := False; h := AddItem('disabled item'); CellValue[OleVariant(h),OleVariant(1)] := 'disabled item'; CellValue[OleVariant(h),OleVariant(2)] := 'disabled item'; EnableItem[h] := False; SelectableItem[h] := False; end; EndUpdate(); end |
833 |
Is it possible to edit a float number without using of e/E/d/D (exponent) and +/- (signs) characters
with Grid1 do begin with (IUnknown(Columns.Add('Edit')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.EditType; Numeric := Integer(EXGRIDLib_TLB.exDisableSigns) Or Integer(EXGRIDLib_TLB.exFloatInteger); end; Items.AddItem(OleVariant(1.22)); end |
832 |
How can I edit a float number with no using of e/E/d/D and + character
with Grid1 do begin with (IUnknown(Columns.Add('Edit')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.EditType; Numeric := Integer(EXGRIDLib_TLB.exDisablePlus) Or Integer(EXGRIDLib_TLB.exFloatInteger); end; Items.AddItem(OleVariant(1.22)); end |
831 |
Is it possible to edit a float number with no using of e/E/d/D (exponent) characters
with Grid1 do begin with (IUnknown(Columns.Add('Edit')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.EditType; Numeric := EXGRIDLib_TLB.exFloatInteger; end; Items.AddItem(OleVariant(1.22)); end |
830 |
How can I edit an integer with no using of +/- signs
with Grid1 do begin with (IUnknown(Columns.Add('Edit')) as EXGRIDLib_TLB.Column).Editor do begin EditType := EXGRIDLib_TLB.EditType; Numeric := EXGRIDLib_TLB.NumericEnum($fc Or Integer(EXGRIDLib_TLB.exDisableSigns) Or Integer(EXGRIDLib_TLB.exFloatInteger) Or Integer(EXGRIDLib_TLB.exFloat)); end; Items.AddItem(OleVariant(1)); end |
829 |
When I'm trying to show string with "line break" character (vbCrLF) in a textbox, it shows 2 squares. Is there any way to hide these squares
with Grid1 do begin with Columns do begin Add('Value'); with (IUnknown(Add('CellSingleLine = False')) as EXGRIDLib_TLB.Column) do begin ComputedField := '%0'; Def[EXGRIDLib_TLB.exCellSingleLine] := OleVariant(False); end; with (IUnknown(Add('FormatColumn/replace CRLF')) as EXGRIDLib_TLB.Column) do begin ComputedField := '%0'; FormatColumn := 'value replace `\r\n` with ``'; end; with (IUnknown(Add('FormatColumn/replace TAB,CRLF')) as EXGRIDLib_TLB.Column) do begin ComputedField := '%0'; FormatColumn := '(value replace `\t` with ``) replace `\r\n` with ``'; end; end; with Items do begin AddItem('a\ta\r\nb\tb'); end; end |
828 |
Is there any way to "unselect" radio group
// DblClick event - Occurs when the user dblclk the left mouse button over an object. procedure TForm1.Grid1DblClick(ASender: TObject; Shift : Smallint;X : Integer;Y : Integer); begin with Grid1 do begin with Items do begin h := CellChecked[1234]; CellHasCheckBox[OleVariant(0),OleVariant(h)] := True; CellState[OleVariant(0),OleVariant(h)] := 0; CellHasCheckBox[OleVariant(0),OleVariant(h)] := False; end; end end; // SelectionChanged event - Fired after a new item has been selected. procedure TForm1.Grid1SelectionChanged(ASender: TObject; ); begin with Grid1 do begin with Items do begin CellState[OleVariant(FocusItem),OleVariant(0)] := 1; end; end end; with Grid1 do begin MarkSearchColumn := False; SelBackColor := RGB(255,255,128); SelForeColor := RGB(0,0,0); Columns.Add('Default'); with Items do begin h := AddItem('Radio 1'); CellHasRadioButton[OleVariant(h),OleVariant(0)] := True; CellRadioGroup[OleVariant(h),OleVariant(0)] := 1234; h := AddItem('Radio 2'); CellHasRadioButton[OleVariant(h),OleVariant(0)] := True; CellRadioGroup[OleVariant(h),OleVariant(0)] := 1234; CellState[OleVariant(h),OleVariant(0)] := 1; h := AddItem('Radio 3'); CellHasRadioButton[OleVariant(h),OleVariant(0)] := True; CellRadioGroup[OleVariant(h),OleVariant(0)] := 1234; end; end |
827 |
The Column.Alignment property does not seem to work for cells with images in them. What can be done
with Grid1 do begin BeginUpdate(); Images('gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTql' + 'Vq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m0' + 'ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/yN' + 'AOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA='); TreeColumnIndex := -1; DrawGridLines := EXGRIDLib_TLB.exAllLines; HeaderHeight := 24; DefaultItemHeight := 24; with (IUnknown(Columns.Add('Image')) as EXGRIDLib_TLB.Column) do begin AllowSizing := False; Width := 32; HTMLCaption := '<img>1</img>'; HeaderAlignment := EXGRIDLib_TLB.CenterAlignment; Alignment := EXGRIDLib_TLB.CenterAlignment; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); end; Columns.Add('Rest'); with Items do begin AddItem('<img>1</img>'); AddItem('<img>2</img>'); AddItem('<img>3</img>'); end; EndUpdate(); end |
826 |
Can I change the format of date to be shown in the control
with Grid1 do begin with Columns do begin Add('Default'); with (IUnknown(Add('Format.1')) as EXGRIDLib_TLB.Column) do begin ComputedField := '%0'; FormatColumn := 'dateF(value) replace `/` with `-`'; end; with (IUnknown(Add('Format.2')) as EXGRIDLib_TLB.Column) do begin ComputedField := '%0'; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); FormatColumn := '`<b>`+ shortdate(value) + `</b> ` + timeF(value)'; end; with (IUnknown(Add('Format.3')) as EXGRIDLib_TLB.Column) do begin ComputedField := '%0'; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); FormatColumn := '( dateF(value) replace `/` with `-` ) + ` <b>`+ ( weekday(value) case ( 0 : `Su`; 1 : `Mo`; 2 : `Tu`; 3 : `We`; 4 : `Th`; 5 : `F' + 'r`; 6 : `Sa`) )'; end; end; with Items do begin AddItem('1/1/2001 10:00:00 AM'); AddItem('1/2/2001 10:00:00 AM'); end; end |
825 |
How do I arrange my columns on multiple levels
with Grid1 do begin BeginUpdate(); ColumnAutoResize := False; DrawGridLines := EXGRIDLib_TLB.exAllLines; with Columns do begin with (IUnknown(Add('C0')) as EXGRIDLib_TLB.Column) do begin ExpandColumns := '1,2'; DisplayExpandButton := False; end; Add('C1'); Add('C2'); Add('C3'); with (IUnknown(Add('C4')) as EXGRIDLib_TLB.Column) do begin ExpandColumns := '5,6'; DisplayExpandButton := False; end; Add('C5'); with (IUnknown(Add('C6')) as EXGRIDLib_TLB.Column) do begin ExpandColumns := '6,7'; DisplayExpandButton := False; end; Add('C7'); end; EndUpdate(); end |
824 |
Does your control support expandable header or columns, so I can arrange it on multiple levels
with Grid1 do begin BeginUpdate(); DrawGridLines := EXGRIDLib_TLB.exAllLines; BackColorLevelHeader := RGB(240,240,240); with Columns do begin with (IUnknown(Add('Photo')) as EXGRIDLib_TLB.Column) do begin AllowSizing := False; Width := 32; end; Add('Personal Info'); Add('Title'); Add('Name'); Add('First'); Add('Last'); Add('Address'); Item['Personal Info'].ExpandColumns := '2,3'; with Item['Name'] do begin ExpandColumns := '4,5'; Expanded := False; end; end; EndUpdate(); end |
823 |
How can I use the MinWidthAutoResize/MaxWidthAutoResize
with Grid1 do begin BeginUpdate(); ColumnAutoResize := False; rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Null); end; DataSource := (IUnknown(rs) as ADODB_TLB.Recordset); with Columns.Item[OleVariant(0)] do begin MaxWidthAutoResize := 32; WidthAutoResize := True; end; EndUpdate(); end |
822 |
Does your control support subscript or superscript, in HTML captions
with Grid1 do begin ColumnAutoResize := False; HeaderHeight := 28; DefaultItemHeight := 24; with Columns do begin with (IUnknown(Add('Column 1')) as EXGRIDLib_TLB.Column) do begin HTMLCaption := 'Column <b><off 2><font ;6>1'; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); end; with (IUnknown(Add('Column 2')) as EXGRIDLib_TLB.Column) do begin HTMLCaption := 'Column <b><off 2><font ;6>2'; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); end; with (IUnknown(Add('Column 3')) as EXGRIDLib_TLB.Column) do begin HTMLCaption := 'Column <b><off 2><font ;6>3'; Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1); end; end; with Items do begin h := AddItem('Item <font ;6><off 4>1'); CellValue[OleVariant(h),OleVariant(1)] := 'Item <font ;6><off -6>2'; CellValue[OleVariant(h),OleVariant(2)] := 'Item <b><font ;6><off -6>2<off 4>3<off 4>1'; end; end |
821 |
How can I specify the splited cell's background color
with Grid1 do begin MarkSearchColumn := False; TreeColumnIndex := -1; (IUnknown(Columns.Add('1')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellBackColor] := OleVariant(255); with (IUnknown(Columns.Add('2')) as EXGRIDLib_TLB.Column) do begin Width := 32; AllowSizing := False; end; with Items do begin h := AddItem('The Item''s background color inherits the Column.Def(exCellBackColor)'); ItemDivider[h] := 0; h := AddItem('The Item''s background color inherits the CellBackColor()'); ItemDivider[h] := 0; CellBackColor[OleVariant(h),Null] := $ff00; h := AddItem('The Item''s background color inherits the CellBackColor(), while the split inherits from the Column.Def(exCellBackColor) '); ItemDivider[h] := 0; CellBackColor[OleVariant(h),Null] := $ff00; var_SplitCell := SplitCell[OleVariant(h),OleVariant(0)]; h := AddItem('The Item''s background color inherits the CellBackColor()'); ItemDivider[h] := 0; CellBackColor[OleVariant(h),Null] := $ff00; CellBackColor[OleVariant(0),SplitCell[OleVariant(h),OleVariant(0)]] := $ff0000; end; end |
820 |
How can I specify a fixed width for a column
with Grid1 do begin MarkSearchColumn := False; TreeColumnIndex := -1; ColumnAutoResize := False; with (IUnknown(Columns.Add('C1')) as EXGRIDLib_TLB.Column) do begin Width := 17; AllowSizing := False; end; with (IUnknown(Columns.Add('C2')) as EXGRIDLib_TLB.Column) do begin Width := 17; AllowSizing := False; end; Columns.Add('Other'); ColumnAutoResize := True; end |
819 |
How can I split a cell in three parts
with Grid1 do begin BeginUpdate(); DrawGridLines := EXGRIDLib_TLB.exAllLines; Columns.Add('Default'); with Items do begin h := AddItem('entire'); h := AddItem('split 1'); h := SplitCell[OleVariant(h),OleVariant(0)]; CellValue[OleVariant(0),OleVariant(h)] := 'split 2'; h := SplitCell[OleVariant(0),OleVariant(h)]; CellValue[OleVariant(0),OleVariant(h)] := 'split 3'; h := AddItem('entire'); end; EndUpdate(); end |
818 |
How can I find if there is any filter applied to the control
// FilterChange event - Occurs when filter was changed. procedure TForm1.Grid1FilterChange(ASender: TObject; ); begin with Grid1 do begin OutputDebugString( 'If negative, the filter is present, else not' ); OutputDebugString( Items.VisibleItemCount ); end end; with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; TreeColumnIndex := -1; FilterInclude := EXGRIDLib_TLB.exMatchingItemsOnly; with (IUnknown(Columns.Add('Column')) as EXGRIDLib_TLB.Column) do begin DisplayFilterButton := True; FilterType := EXGRIDLib_TLB.exFilter; Filter := 'C1'; end; with Items do begin h := AddItem('R1'); InsertItem(h,Null,'C1'); InsertItem(h,Null,'C2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Null,'C1'); InsertItem(h,Null,'C2'); end; ApplyFilter(); EndUpdate(); end |
817 |
How can I prevent showing the lines for the hierarchy while using the exMatchingItemsOnly option
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; TreeColumnIndex := -1; FilterInclude := EXGRIDLib_TLB.exMatchingItemsOnly; with (IUnknown(Columns.Add('Column')) as EXGRIDLib_TLB.Column) do begin DisplayFilterButton := True; FilterType := EXGRIDLib_TLB.exFilter; Filter := 'C1|C2'; end; with Items do begin h := AddItem('R1'); InsertItem(h,Null,'C1'); InsertItem(h,Null,'C2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Null,'C1'); InsertItem(h,Null,'C2'); end; ApplyFilter(); EndUpdate(); end |
816 |
Is there any method to get only the matched items and not the items with his parent
with Grid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot; FilterInclude := EXGRIDLib_TLB.exMatchingItemsOnly; with (IUnknown(Columns.Add('Column')) as EXGRIDLib_TLB.Column) do begin DisplayFilterButton := True; FilterType := EXGRIDLib_TLB.exFilter; Filter := 'C1|C2'; end; with Items do begin h := AddItem('R1'); InsertItem(h,Null,'C1'); InsertItem(h,Null,'C2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Null,'C1'); InsertItem(h,Null,'C2'); end; ApplyFilter(); EndUpdate(); end |
815 |
Is there any property I can save and restore automatically the current setting, column position, size, and so on (2)
with Grid1 do begin BeginUpdate(); Columns.Add('Column'); with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); end; Layout := 'Select="0";SingleSort="C0:2";Columns=1'; EndUpdate(); end |
814 |
Is there any property I can save and restore automatically the current setting, column position, size, and so on (1)
with Grid1 do begin BeginUpdate(); Columns.Add('Column'); with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); end; Layout := 'gBjAAwAAuABmABpABsAB0ABlAByhoAPIAOEPAA9gYABoABQAgUEg0XN4AOcJicKkpujMbjsfkMFk0YhkQgUOjUEl8gjcGO0ok8KMULjEaGMcj08kQAO8oMkTNEtGwAGQ' + 'Aqc7gUlhh1ABtAEsk9GpEfhElgVcsMupNlnlonlaAFcr0shUsp8QPEtnVJqJhmcIhUMh0QiU5sYAqMngUSuEMw07k8Qv0SgVRrNEuVflF2jF5x9JyNEm0TjQijemyE0j' + 'E3t+YruauoAu4Az1qj9BzRn0UzksSnAA0xDjY6qnAw8OiUQ0dwzN0zWz2t7j8/xURAGNvWH6k8xlEhklhEI0O/6QAgI='; EndUpdate(); end |
813 |
I have noticed that the column's header is changed once the cursor hovers it. Is it possible to change that visual appearance
|
812 |
Is it possible to change the visual appearance of the columns selector/floating bar(3)
with Grid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (IUnknown(Add('Column 2')) as EXGRIDLib_TLB.Column).Visible := False; end; VisualAppearance.Add(2,'c:\exontrol\images\normal.ebn'); VisualAppearance.Add(3,'c:\exontrol\images\pushed.ebn'); Background[EXGRIDLib_TLB.exColumnsFloatAppearance] := $2000000; Background[EXGRIDLib_TLB.exColumnsFloatBackColor] := $3000000; Background[EXGRIDLib_TLB.exColumnsFloatCaptionBackColor] := $f0f5f6; ColumnsFloatBarVisible := EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
811 |
Is it possible to change the visual appearance of the columns selector/floating bar(2)
with Grid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (IUnknown(Add('Column 2')) as EXGRIDLib_TLB.Column).Visible := False; end; VisualAppearance.Add(3,'c:\exontrol\images\pushed.ebn'); Background[EXGRIDLib_TLB.exColumnsFloatBackColor] := $3000000; ColumnsFloatBarVisible := EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
810 |
Is it possible to change the visual appearance of the columns selector/floating bar(1)
|
809 |
I am using the ColumnsFloatBarVisible property on True, but still not able to add any column on that list
with Grid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (IUnknown(Add('Column 2')) as EXGRIDLib_TLB.Column).Visible := False; end; ColumnsFloatBarVisible := EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
808 |
Is it possible to list a column to columns selector/floating bar, but still user can use it
with Grid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (IUnknown(Add('Column 2')) as EXGRIDLib_TLB.Column).Visible := False; with (IUnknown(Add('Column 3')) as EXGRIDLib_TLB.Column) do begin Visible := False; Enabled := False; end; end; ColumnsFloatBarVisible := EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
807 |
How can I prevent a specific column not to be listed in the columns selector/floating bar
with Grid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (IUnknown(Add('Column 2')) as EXGRIDLib_TLB.Column).Visible := False; with (IUnknown(Add('Column 3')) as EXGRIDLib_TLB.Column) do begin Visible := False; AllowDragging := False; end; end; ColumnsFloatBarVisible := EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
806 |
Is it possible to change the "Columns" caption being shown in the columns selector/floating bar
with Grid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (IUnknown(Add('Column 2')) as EXGRIDLib_TLB.Column).Visible := False; end; Description[EXGRIDLib_TLB.exColumnsFloatBar] := 'Hidden Columns'; ColumnsFloatBarVisible := EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
805 |
How can I show the columns selector, so the user can drag and drop columns to the view
with Grid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (IUnknown(Add('Column 2')) as EXGRIDLib_TLB.Column).Visible := False; end; ColumnsFloatBarVisible := EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
804 |
The column's header is changed while the cursor hovers it. Is it possible to prevent that
|
803 |
I noticed that when grouping on a field, its details are always expanded. Is it possible to show collapsed by default (method 2)
with Grid1 do begin BeginUpdate(); ColumnAutoResize := False; rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Null); end; DataSource := (IUnknown(rs) as ADODB_TLB.Recordset); SortBarVisible := True; SortBarCaption := 'Drag a <b>column</b> header here to group by that column.'; AllowGroupBy := True; Columns.Item[OleVariant(1)].SortOrder := EXGRIDLib_TLB.SortAscending; EndUpdate(); BeginUpdate(); EnsureVisibleColumn(OleVariant(0)); Items.ExpandItem[0] := False; EndUpdate(); end |
802 |
I noticed that when grouping on a field, its details are always expanded. Is it possible to show collapsed by default (method 1)
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection. procedure TForm1.Grid1AddGroupItem(ASender: TObject; Item : HITEM); begin with Grid1 do begin Items.ExpandItem[Item] := False; end end; with Grid1 do begin BeginUpdate(); ColumnAutoResize := False; rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Null); end; DataSource := (IUnknown(rs) as ADODB_TLB.Recordset); SortBarVisible := True; SortBarCaption := 'Drag a <b>column</b> header here to group by that column.'; AllowGroupBy := True; Columns.Item[OleVariant(1)].SortOrder := EXGRIDLib_TLB.SortAscending; EndUpdate(); end |
801 |
Is there a possibility to expand / collapse all groups (or group by group) at runtime with a method (equivalent to pressing the + or - button in the group header)
with Grid1 do begin BeginUpdate(); ColumnAutoResize := False; rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset'))) as ADODB_TLB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Null); end; DataSource := (IUnknown(rs) as ADODB_TLB.Recordset); SortBarVisible := True; SortBarCaption := 'Drag a <b>column</b> header here to group by that column.'; AllowGroupBy := True; Columns.Item[OleVariant(1)].SortOrder := EXGRIDLib_TLB.SortAscending; EndUpdate(); EnsureVisibleColumn(OleVariant(0)); BeginUpdate(); with Items do begin ExpandItem[RootItem[0]] := False; ExpandItem[RootItem[1]] := False; ExpandItem[RootItem[2]] := False; end; EndUpdate(); end |